const mongoose = require('mongoose');
const addressSchema = new mongoose.Schema({
    default:            {type: Boolean,default:false},
    name:               {type: String,default:''},
    ads_phone:          {type: String,default:''},
    province:           {type: String,default:''},
    city:               {type: String,default:''},
    area:               {type: String,default:''},
    town:               {type: String,default:''},
    street:             {type: String,default:''},
    detail:             {type: String,default:''},
    address_crood:      {type: String,default: ''},//地址坐标

})
const schema = new mongoose.Schema({
    belong_phone:       {type: String,default: ''},//订单发起人账号
    belong_name:        {type: String,default: ''},
    order_info:[{
        belong_phone:       {type: String,default: ''},//订单发起人账号
        belong_name:        {type: String,default: ''},
        collector_phone:    {type: String,default: ''},//接单的回收员
        collector_name:     {type: String,default: ''},
        status:             {type: Number,default: 0 },//订单状态
        wastes:             {type: Array,default: [] },//废品列表
        waste_price_all:    {type: Number,default: ''},
        release_time:       {type: String,default: ''},//发布时间
        settle_time:        {type: String,default: ''},//接单时间
        complete_time:      {type: String,default: ''},//完成时间
        // address:            {type: String,default: ''},//这里指向id
        address:            addressSchema,
        note:               {type: String,default: ''},//备注
        start_time:         {type: String,default: ''},
        end_time:           {type: String,default: ''},
        evaluate_time:      {type: String,default: ''},
        evaluate_content:   {type: String,default: ''},
        evaluate_speed:     {type: String,default: ''},//上门速度
        evaluate_attitude:  {type: String,default: ''},//服务态度
        feedback:           {type: String,default: ''},//反馈
        }]
})
module.exports = mongoose.model('OrderUser',schema);
